<!doctype html>
<html>
<head>
    <title>API for class TEMPLATE (Events Calendar v1.0)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="generator" content="phpAPI 6.0 (https://github.com/Greenray/phpAPI/)">
    <link href="../style.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <div class="page">
        <div class="header center">
            <div class="content">
                Events Calendar v1.0                <div class="logo_desc">Application Programming Interface</div>
            </div>
        </div>
        <div class="panel">
            <div class="content">
                <h1>Namespaces</h1>
<ul>
    <li><a href="../calendar/package-summary.html">Calendar</a></li>
    <li><a href="../no package/package-summary.html">No Package</a></li>
    <li><a href="../template/package-summary.html">Template</a></li>
</ul>
<h1>Namespace Template</h1>
    <h2>Classes</h2>
    <ul>
            <li><a href="../template/template.html" title="Template \ TEMPLATE">TEMPLATE</a></li>
        </ul>
            </div>
        </div>
        <div class="main">
            <div class="content">
                <nav class="menu_main center"><div class="menu">
            <ul>
                    <li><a href="../index.html">Overview</a></li>
                    <li><a href="../template/package-summary.html">Namespace</a></li>
                    <li class="active">Class</li>
                    <li><a href="../template/package-tree.html">Template\Tree</a></li>
                    <li><a href="../deprecated.html">Deprecated</a></li>
                    <li><a href="../todo.html">Todo</a></li>
                    <li><a href="../index-all.html">Index</a></li>
                </ul>
    </div>
    <div class="small_links">
        <a href="#details_fields">Fields</a> | <a href="#details_methods">Methods</a> | <a href="#details_constructor">Constructor</a>
    </div>
</nav>
                <hr />
<div class="package">Namespace Template</div>
<h1>Class TEMPLATE</h1>
<div id="list">
    <ul>
        <li><strong>TEMPLATE</strong></li></ul></li>    </ul>
</div>
<hr />
<p class="arguments">public  class <strong>TEMPLATE</strong></p>
<div class="comment" id="overview_description">PHP Template Compiler.</div>
<div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Version</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">2.0</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Author</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Victor Nabatov &lt;greenray.spb@gmail.com&gt;</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Copyright</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">(c) 2016 Victor Nabatov</td>
                    </tr>
            <tr>
            <td class="hid left w_100">License</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Creative Commons Attribution-ShareAlike 4.0 International</td>
                    </tr>
            <tr>
            <td class="hid left w_100">File</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">template.class.php</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Overview</td>
            <td class="hid right w_100 lilac">&nbsp;</td>
                            <td class="hid" colspan="2">Handles special tags and replaces them with commands of the php interpreter.
 It is able recursively execute functions and directives:
 FOREACH, IF, ELSE, ELSEIF, SWITCH, CASE, BREAK, DEFAULT, INCLUDE, CONTINUE.
 There is a possibility of compressing and caching the result.
 Completely separated from php code.
 Requires PHP 5.4</td>
                    </tr>
        </table>
</div>
    <h2 id="details_fields">Fields</h2>
            <div class="location">classes/template.class.php at line 22</div>
        <pre class="arguments" id="code">private  string <strong><span class="green">$code</span></strong> = <span class="red">""</span>;</pre>
        <div class="details">Template content</div>
        <hr />
            <div class="location">classes/template.class.php at line 25</div>
        <pre class="arguments" id="file">private  string <strong><span class="green">$file</span></strong> = <span class="red">""</span>;</pre>
        <div class="details">Name of the template file that is currently executing</div>
        <hr />
            <div class="location">classes/template.class.php at line 28</div>
        <pre class="arguments" id="languages">private  array <strong><span class="green">$languages</span></strong> = [];</pre>
        <div class="details">Languages</div>
        <hr />
            <div class="location">classes/template.class.php at line 31</div>
        <pre class="arguments" id="line">private  integer <strong><span class="green">$line</span></strong> = 0;</pre>
        <div class="details">Current line of the template content</div>
        <hr />
            <div class="location">classes/template.class.php at line 34</div>
        <pre class="arguments" id="options">private  array <strong><span class="green">$options</span></strong> = [];</pre>
        <div class="details">Processing options</div>
        <hr />
            <div class="location">classes/template.class.php at line 37</div>
        <pre class="arguments" id="statements">private  array <strong><span class="green">$statements</span></strong> = [<br />        <span class="red">"BREAK"</span>    =&gt; <span class="red">"&lt;?php break;?&gt;"</span>,<br />        <span class="red">"CONTINUE"</span> =&gt; <span class="red">"&lt;?php continue;?&gt;"</span>,<br />        <span class="red">"ELSE"</span>     =&gt; <span class="red">"&lt;?php } else { ?&gt;"</span>,<br />        <span class="red">"DEFAULT"</span>  =&gt; <span class="red">"&lt;?php default: ?&gt;"</span>,<br />        <span class="red">"END"</span>      =&gt; <span class="red">"&lt;?php } ?&gt;"</span><br />    ];</pre>
        <div class="details">Template statements</div>
        <hr />
            <div class="location">classes/template.class.php at line 40</div>
        <pre class="arguments" id="temp">private  array <strong><span class="green">$temp</span></strong> = [];</pre>
        <div class="details">Temporary variable for code processing</div>
        <hr />
            <div class="location">classes/template.class.php at line 43</div>
        <pre class="arguments" id="vars">public  array <strong><span class="green">$vars</span></strong> = [];</pre>
        <div class="details">Template variables</div>
        <hr />
        <h2 id="details_constructor">Constructor</h2>
    <div class="location">classes/template.class.php at line 51</div>
    <code class="arguments" id="construct">public  void <strong>construct</strong>(<span class="lilac">array</span> <span class="blue">$template</span>, <span class="lilac">array</span> <span class="blue">$options</span>)</code>
    <div class="details">
            <span class="bold">include</span> LANGUAGES.$this->options[<span class="red">'language'</span>].<span class="red">'.php'</span>;<br/><br/>            <p class="description">Class constructor.</p>
        <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$template</td>
                <td class="hid">Template file</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$options</td>
                <td class="hid">Processing options. Default is empty</td>
                    </tr>
        </table>
</div>
    </div>
    <h2 id="details_methods">Methods</h2>
            <div class="location">classes/template.class.php at line 73</div>
        <code class="arguments" id="getTemplate">private  void <strong>getTemplate</strong> (<span class="lilac">string</span> <span class="blue">$template</span>)</code>
        <div class="details">
                    <p class="description">Reads template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$template</td>
                <td class="hid">Template filename with full path</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 99</div>
        <code class="arguments" id="set">public  void <strong>set</strong> (<span class="lilac">mixed</span> <span class="blue">$var</span>, <span class="lilac">mixed</span> <span class="blue">$value</span>)</code>
        <div class="details">
                    <p class="description">Sets variables (plain or array) for the template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">mixed</td>
                            <td class="hid blue w_100">$var</td>
                <td class="hid">Variable name</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">mixed</td>
                            <td class="hid blue w_100">$value</td>
                <td class="hid">Variable value</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 110</div>
        <code class="arguments" id="parse">public  string <strong>parse</strong> ()</code>
        <div class="details">
                    <p class="description">Parses the template file.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed template</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 185</div>
        <code class="arguments" id="parseLine">private  string <strong>parseLine</strong> (<span class="lilac">string</span> <span class="blue">$code</span>)</code>
        <div class="details">
                    <p class="description">Parses a line of code.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Line of code</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Code transformed in php code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 255</div>
        <code class="arguments" id="createVar">private  string <strong>createVar</strong> (<span class="lilac">string</span> <span class="blue">$code</span>)</code>
        <div class="details">
                    <p class="description">Creates variable.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Template basic code</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 279</div>
        <code class="arguments" id="_foreach">private  string <strong>_foreach</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Trasnforms the FOREACH structure in php code.<br /> <pre><br /> The template is:<br />   <!-- FOREACH $array --><br />   <!-- FOREACH $array.index --><br />   <!-- CONTINUE --><br /> </pre></p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Parameters for FOREACH structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 299</div>
        <code class="arguments" id="_if">private  string <strong>_if</strong> (<span class="lilac">string</span> <span class="blue">$code</span>)</code>
        <div class="details">
                    <p class="description">Transforms the IF structure in php code.<br /> <pre><br /> The template is:<br />   <!-- IF !empty($var) --><br /> </pre></p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$code</td>
                <td class="hid">Code for IF structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 313</div>
        <code class="arguments" id="_switch">private  string <strong>_switch</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Transforms the SWITCH structure in php code.<br /> <pre><br /> The template is:<br />   <!-- SWITCH $var --><br /> </pre></p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Code for the SWITCH structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 327</div>
        <code class="arguments" id="_case">private  string <strong>_case</strong> (<span class="lilac">string</span> <span class="blue">$param</span>)</code>
        <div class="details">
                    <p class="description">Transforms the CASE structure in php code.<br /> <pre><br /> The template is:<br />   <!-- CASE $var --><br /> </pre></p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$param</td>
                <td class="hid">Parameter for CASE structure</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">PHP code</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 344</div>
        <code class="arguments" id="translate">private  string <strong>translate</strong> (<span class="lilac">array</span> <span class="blue">$match</span>)</code>
        <div class="details">
                    <p class="description">Localization.<br /> <pre><br /> The template is:<br />   string<br /> </pre><br /> Array variable $matches contains:<br />  - $matches[0] = part of template between control structures including them;<br />  - $matches[1] = part of template between control structures excluding them.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$match</td>
                <td class="hid">Matches for translation</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 358</div>
        <code class="arguments" id="value">private  string <strong>value</strong> (<span class="lilac">array</span> <span class="blue">$match</span>)</code>
        <div class="details">
                    <p class="description">Replaces constants and global variables with their values.<br /> <pre><br /> The template is:<br />   {CONST} - global constant<br /> </pre></p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">array</td>
                            <td class="hid blue w_100">$match</td>
                <td class="hid">Matches for constants</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Parsed string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 370</div>
        <code class="arguments" id="getFromCache">public  mixed <strong>getFromCache</strong> (<span class="lilac">string</span> <span class="blue">$file</span>)</code>
        <div class="details">
                    <p class="description">Gets a data from the cache.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$file</td>
                <td class="hid">Page name</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">mixed</td>
                            <td class="hid" colspan="2">Page from cache</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 392</div>
        <code class="arguments" id="compact">private  string <strong>compact</strong> (<span class="lilac">string</span> <span class="blue">$data</span>)</code>
        <div class="details">
                    <p class="description">Compacts compiled template.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$data</td>
                <td class="hid">Compiled template</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Code without newlines and extra spaces</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 412</div>
        <code class="arguments" id="toCache">public  void <strong>toCache</strong> (<span class="lilac">string</span> <span class="blue">$file</span>, <span class="lilac">string</span> <span class="blue">$data</span>)</code>
        <div class="details">
                    <p class="description">Places the compiled data into cache.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$file</td>
                <td class="hid">Page name</td>
                    </tr>
            <tr>
            <td class="hid left w_100">&nbsp</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$data</td>
                <td class="hid">Page to store in the cache</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 424</div>
        <code class="arguments" id="randomString">private  string <strong>randomString</strong> (<span class="lilac">integer</span> <span class="blue">$num_chars</span>)</code>
        <div class="details">
                    <p class="description">Generates random string.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">integer</td>
                            <td class="hid blue w_100">$num_chars</td>
                <td class="hid">The lenght of string to generate</td>
                    </tr>
            <tr>
            <td class="hid left w_100">Return</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid" colspan="2">Generated string</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
            <div class="location">classes/template.class.php at line 443</div>
        <code class="arguments" id="error">public  void <strong>error</strong> (<span class="lilac">string</span> <span class="blue">$msg</span>)</code>
        <div class="details">
                    <p class="description">Shows an error message.</p>
            <div class="finfo">
    <table class="hid">
            <tr>
            <td class="hid left w_100">Parameters</td>
            <td class="hid right w_100 lilac">string</td>
                            <td class="hid blue w_100">$msg</td>
                <td class="hid">Error message to output</td>
                    </tr>
        </table>
</div>
        </div>
        <hr />
                    <nav class="menu_main center"><div class="menu">
            <ul>
                    <li><a href="../index.html">Overview</a></li>
                    <li><a href="../template/package-summary.html">Namespace</a></li>
                    <li class="active">Class</li>
                    <li><a href="../template/package-tree.html">Template\Tree</a></li>
                    <li><a href="../deprecated.html">Deprecated</a></li>
                    <li><a href="../todo.html">Todo</a></li>
                    <li><a href="../index-all.html">Index</a></li>
                </ul>
    </div>
    <div class="small_links">
        <a href="#details_fields">Fields</a> | <a href="#details_methods">Methods</a> | <a href="#details_constructor">Constructor</a>
    </div>
</nav>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="content">
            <div class="copyright center">Generated by <a href="https://github.com/Greenray/phpAPI" target="_blank">phpAPI</a>: PHP Documentation Creator ver. 6.0 &copy; 2015 - 2016 Greenray</div>
        </div>
    </div>
</body>
</html>
